Poulette
Lurker
Hello,
I have one widget and one separated app
The widget can launch the application by passing parameters
typically I put 3 times the same widget on my home page with 3 different settings, for example A B and C
When I click on my first widget A, the application opens and receives the parameter A, good !!!
but now if I click on widget B, the application switches to foreground but does not receive parameter B
I think I know why, but I can not find a workaround:
----------------------------------------------------------
In my widget I have this code to apen the app :
Intent intentAppli = new Intent(Intent.ACTION_MAIN);
intentAppli.addCategory(Intent.CATEGORY_LAUNCHER);
intentAppli.putExtra("system_to_show", system);
intentAppli.setClassName("com.santeos.meteoSanteos", "com.santeos.meteoSanteos.MainActivity");
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intentAppli, PendingIntent.FLAG_UPDATE_CURRENT);
views.setOnClickPendingIntent(R.id.id_projet, pendingIntent);
----------------------------------------------------------------
in my app I have in the onCreate
Bundle extras = getIntent().getExtras();
if(extras == null) {
systemToShow= null;
} else {
systemToShow= extras.getString("system_to_show");
}
if(systemToShow!=null)
{
//TODO here get the string stored in the string variable and do
// setText() on userName
Toast.makeText(MainActivity.this,systemToShow, Toast.LENGTH_LONG).show();
baseUrl=baseUrl+"&toshow="+systemToShow;
}
Here I understand that it will work only when creating the app.
But I have tryed to move this code in the onResume and I always have the first parameter use to launch the app first time, and never the second one or third....
It seems that the intent is never updated with the extra parameter
Thanks for any help !!!
Best regards,
Laurent
I have one widget and one separated app
The widget can launch the application by passing parameters
typically I put 3 times the same widget on my home page with 3 different settings, for example A B and C
When I click on my first widget A, the application opens and receives the parameter A, good !!!
but now if I click on widget B, the application switches to foreground but does not receive parameter B
I think I know why, but I can not find a workaround:
----------------------------------------------------------
In my widget I have this code to apen the app :
Intent intentAppli = new Intent(Intent.ACTION_MAIN);
intentAppli.addCategory(Intent.CATEGORY_LAUNCHER);
intentAppli.putExtra("system_to_show", system);
intentAppli.setClassName("com.santeos.meteoSanteos", "com.santeos.meteoSanteos.MainActivity");
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intentAppli, PendingIntent.FLAG_UPDATE_CURRENT);
views.setOnClickPendingIntent(R.id.id_projet, pendingIntent);
----------------------------------------------------------------
in my app I have in the onCreate
Bundle extras = getIntent().getExtras();
if(extras == null) {
systemToShow= null;
} else {
systemToShow= extras.getString("system_to_show");
}
if(systemToShow!=null)
{
//TODO here get the string stored in the string variable and do
// setText() on userName
Toast.makeText(MainActivity.this,systemToShow, Toast.LENGTH_LONG).show();
baseUrl=baseUrl+"&toshow="+systemToShow;
}
Here I understand that it will work only when creating the app.
But I have tryed to move this code in the onResume and I always have the first parameter use to launch the app first time, and never the second one or third....
It seems that the intent is never updated with the extra parameter
Thanks for any help !!!
Best regards,
Laurent