I am trying to send an intent to a 3rd party app. I contacted the app's author and he told me how he sends shortcuts. I am sending my intent the same way, however it isn't working. If I use one of his home screen shortcuts, it all works fine. If I try sending an intent, I get a black screen from his app a few seconds after sending the intent. Once this happens, launching his app in any way causes the black screen to appear. The only way get his app to work again is to reboot the phone.
Below are some quotes from him on how to use it. To protect his privacy I have changed "key" information:
... And below is my code. Naturally the string sPackageName contains the name of his package and sCMD contains the command to send such as "Vol UP":
Any ideas on why this is crashing his app?
Below are some quotes from him on how to use it. To protect his privacy I have changed "key" information:
This Is In my Main Activity To create the Intent (package: my.packagepro OR For trial: my.packagetrial)
Intent shortcutIntent = new Intent(this,Launch2.class);
shortcutIntent.putExtra("shortcut", nr);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
the variable nr gives the function:
(Here he lists possible values of nr such as "Vol UP", etc.....)
Launch2 handles the intent.
This is in onCreate of Launch2
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MyApplicationClass.killit = true;
Bundle extras = getIntent().getExtras();
if (extras != null && extras.getInt("shortcut")>0) {
initMyApp(false);
int nrc = extras.getInt("shortcut")-1;
MySub.onecommand(nrc);
}
}
... And below is my code. Naturally the string sPackageName contains the name of his package and sCMD contains the command to send such as "Vol UP":
B4X:
Dim VCIntent As Intent
Try
VCIntent.Initialize("", "")
VCIntent.SetComponent(sPackageName & "/" & sPackageName & ".Launch2")
VCIntent.PutExtra("shortcut", sCMD)
VCIntent.Flags = 268435456 'FLAG_ACTIVITY_NEW_TASK
StartActivity (VCIntent)
Catch
Msgbox ("Failed to send command via intent to " & sPackageName & ".", "Uh-oh!")
End Try
Any ideas on why this is crashing his app?