After a more thorough check, I don't think that it will currently work. Currently you cannot distinguish between multiple instances of the same widget
Please see my previous post. The question is how are you adding the intent filter.
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute(Main, "android:excludeFromRecents", "true")
SetActivityAttribute(Menu, "android:excludeFromRecents", "true")
AddReceiverText(srvPickUp, <intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>)
AddReceiverText(srvPickUp, <intent-filter>
<action android:name="android.media.VOLUME_CHANGED_ACTION" />
</intent-filter>)
AddPermission("android.permission.CALL_PHONE")
AddPermission(android.permission.MODIFY_AUDIO_SETTINGS)
'End of default text.
AddReceiverText(srvPickUp, <intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>)
AddReceiverText(srvPickUp, <intent-filter>
<action android:name="android.media.VOLUME_CHANGED_ACTION" />
</intent-filter>)
Sub Service_Start (StartingIntent As Intent)
Broadcast.addAction("android.media.VOLUME_CHANGED_ACTION")
Broadcast.SetPriority(2147483647)
Broadcast.registerReceiver("")
Log(Broadcast)
'Controllo volume
Dim curVol As Int
If StartingIntent.HasExtra("android.media.EXTRA_VOLUME_STREAM_VALUE") Then
' prevVol = StartingIntent.GetExtra("android.media.EXTRA_PREV_VOLUME_STREAM_VALUE")
curVol = StartingIntent.GetExtra("android.media.EXTRA_VOLUME_STREAM_VALUE")
'volType = StartingIntent.GetExtra("android.media.EXTRA_VOLUME_STREAM_TYPE")
Log("Servoice_Start: Volume " & Main.DestroyApp)
....
....
Log(Broadcast)
com.rootsoft.broadcastreceiver.BroadCastReceiver@4215d308
Menu:KeyPress
** Activity (menu) Pause, UserClosed = true **
** Service (srvpickup) Start **
com.rootsoft.broadcastreceiver.BroadCastReceiver@4215d308
** Service (srvpickup) Start **
com.rootsoft.broadcastreceiver.BroadCastReceiver@4215d308
java.lang.RuntimeException: Error receiving broadcast Intent { act=android.media.VOLUME_CHANGED_ACTION flg=0x10 (has extras) } in com.rootsoft.broadcastreceiver.BroadCastReceiver$1@4215d798
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:765)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4777)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.Exception: Sub broadcastreceiver_onreceive signature does not match expected signature.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:201)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:159)
at com.rootsoft.broadcastreceiver.BroadCastReceiver$1.onReceive(BroadCastReceiver.java:110)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:755)
... 9 more
Caused by: java.lang.Exception: Sub broadcastreceiver_onreceive signature does not match expected signature.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:177)
... 12 more
Sub BroadcastReceiver_OnReceive (Action As String)
ToastMessageShow(Action,False)
'can only abort when sendOrderedbroadcast is called.
Broadcast.AbortBroadcast
End Sub
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Error receiving broadcast Intent { act=android.media.VOLUME_CHANGED_ACTION flg=0x10 (has extras) } in com.rootsoft.broadcastreceiver.BroadCastReceiver$1@4212ba90
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:765)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4777)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.Exception: Sub broadcastok_onreceive signature does not match expected signature.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:201)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:159)
at com.rootsoft.broadcastreceiver.BroadCastReceiver$1.onReceive(BroadCastReceiver.java:110)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:755)
... 9 more
Caused by: java.lang.Exception: Sub broadcastok_onreceive signature does not match expected signature.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:177)
... 12 more
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?