send message and open App after ckick 'OK'

Solved
R
rathasatekun
Gosoft (Thailand) Co.,Ltd.

HI SOTI Support

I want to provide open Application after user click OK on Device message (use Mobicontrol send message function)  Step as Below

1. I send Message to information

2. Device Have been shown message

3. user click 'OK' in message

4. Open Application after click 'OK'

I'm not sure send message can do it or may be use another function

5 years ago
SOTI MobiControl
ANSWERS
MD
Matt Dermody Diamond Contributor
4 years ago
mobicontrol.message.createYesNoDialog('Would you like to open the app now?').withCallback(onConfirm).show();

function onConfirm(result) {
    if (result.isYesButton) {
        mobicontrol.log.info('The Yes button was clicked');
         mobicontrol.app.start('YOURAPPPACKAGENAME');
} else if (result.isNoButton) { mobicontrol.log.info('The No button was clicked'); } else if (result.isDismissed) { mobicontrol.log.info('The dialog was dismissed'); } }
Solution
C
Christophe
5 years ago

Hello,

We d like more info about your configuration -> mobicontrol version / device mark / ...

But on the doc for version 14 on mobicontrol I read that it's possible but never try 

here is it the doc -> search after showmessagebox

soti.net/mc/help/v14.0/en/scriptcmds/reference/androidplus.html

Thanks

R
rathasatekun
5 years ago

Thx I found but i not found start app 

C
Christophe
5 years ago

just send an intent … I think

see doc about mobicontrol script and command sendintent

D
DDMOD@SOTI
5 years ago (edited 5 years ago)

Hi Rathasatekun,

As suggested by Christophe, please follow the below help file for The sendintent Command to start an activity(open an application) when the device user clicks on 'OK' on the device:

https://www.soti.net/mc/help/v15.1/en/scriptcmds/reference/sendintent.html

An sendintent script command requires two parameters: the type of intent and the intent URL.

The type of intent can be an activity (-a), a service (-s), or a broadcast (-b).

The intent URL is composed using one of two different kinds of syntax. Either the intent URI, which uses conventional URI format, or using the following format:

"intent:[dataURI]#Intent;[schemeOfTheDataURI];[action=];[component=];[category=];[launchFlags=];[extraKeyValuePair=];end"

For example,

Regards,

R
rathasatekun
5 years ago

Hi I try script but script not work as Details Below

My server

My Client Mobicontrol 14.2.1 Build 1083

mobicontrol version Version: 15.0.2.1049 

My Tested Device Samsung Model SM-A750GN 

1. I tested Script messagebox it's OK

showmessagebox "tested messagebox?" NO_TIMER 4 YES
if %ShowMessageBoxReturn% == IDYES goto EXIT
 
2. I tested Open Web on Chrome it's OK
sendintent -a "https://www.google.com#Intent;action=android.intent.action.VIEW;end" 
 
3. I testd Messagebox and the press YES then Open Website --> it's not work
showmessagebox "OPEN GOGOLE?" NO_TIMER 2 YES
if %ShowMessageBoxReturn% == IDYES goto sendintent -a "https://www.google.com#Intent;action=android.intent.action.VIEW;end" EXIT
 
Remark I use 2 because of in mobicontrol version Version: 15.0.2.1049 
2 is Yes Cancel
4 is OK Cancel
 
 
4. I want to open some app but i dont understand syntax sendintent 
"intent:[dataURI]#Intent;[schemeOfTheDataURI];[action=];[component=];[category=];[launchFlags=];end"
what is dataURI, action and component?

   

R
rathasatekun
5 years ago

i have more problem

I can open app with sendintent but i have problem that

I use 

sendintent -a "intent:#Intent;action=android.intent.action.MAIN;component=android.intent.category.APP_CALENDAR;end"

and

Why  my device open Gallery How to clear cache or something and exe it to correct?

R
rathasatekun
5 years ago

i have more problem

I can open app with sendintent but i have problem that

I use 

sendintent -a "intent:#Intent;action=android.intent.action.MAIN;component=android.intent.category.APP_CALENDAR;end"

I change to other component but it open Gallery App only

and Sendmessagebox still cannot exe sendintent after press OK/YES 

R
rathasatekun
5 years ago

Hi Support 

I have been tested script and i found problem as below

Details

Android enterprise

My Client Mobicontrol 14.2.1 Build 1083

mobicontrol version Version: 15.0.2.1049 

Problem Details

Script1

showmessagebox "OPEN APP?" NO_TIMER 2 YES
if %ShowMessageBoxReturn% == IDYES goto sendintent -a "intent:#Intent;action=android.intent.action.MAIN;component=android.intent.category.APP_MESSAGING;end"

Message show but click YES not open APP

Script2

sendintent -a "intent:#Intent;action=android.intent.action.MAIN;component=android.intent.category.APP_MESSAGING;end"

sendintent -a "intent:#Intent;action=android.intent.action.MAIN;component=android.intent.category.APP_CALENDAR;end"

It open only Gallery APP

RC
Raymond Chan Diamond Contributor
5 years ago (edited 4 years ago)

Hi   Rathasatekun, 

Is your app to be run very special or did I miss anything from your post?  Do you know the bundle ID of the app you want to start?  If so, just use the "start" script command.  I just can't think of any reason why an intent should be used in such case.  

Regarding the conditional showmessagebox script command involving OK button,  my tests since its introduction many months ago have never given any positive result in changing script program flow.    However, as DDMOD told you in a post to use intent after clicking the OK button, I believe you can ask him/her to give an actual script example and test conditions that can have conditiional program flow done successfully.  I myself love very much to learn how to use this new feature too.

J
JVMOD@SOTI
4 years ago

Hello Rathasatekun,


Following up on this thread, were you able to resolve the issue? If yes, I would like to know what were the steps taken to resolve the issue and I can mark that as a Solution.


Regards,

RC
Raymond Chan Diamond Contributor
4 years ago (edited 4 years ago)

Hi   Rathasatekun, 

With the new features recently added to javascript engine, you might have the option to use equvalent of showmessagebox script command if your Android device agent is recent enough to have such features supported (Note : The MobiControl server version is not significant) .  In particular, the following namespace/methods together with conditonal construct in the javascript language should solve your problem:

    mobicontrol.message.createOkCancelDialog

    mobicontrol.message.createYesNolDialog

    mobicontrol.app.start

 

For details of the latest features, check the online doumentation at

https://www.soti.net/mc/help/javascriptapi/en/index.html

M
Maximilian
4 years ago

Do you've any solution for your case? I want to open a defined URL with chrome after clicking ok...

This Script just opens chrome, because i cant find a way to define a URL...

var buttonLabels = ['öffnen'];
mobicontrol.message.createInfoDialog('Text for Messagebox').withButtons(buttonLabels[0]).withCallback(onConfirm).show();

function onConfirm(result) {
if (result.buttonIndex != null) {
mobicontrol.log.info('The E-Mail OK button was clicked');
mobicontrol.app.start('com.android.chrome');
}
}

This old sendintent script works fine but there's no way to put this in a showmessagebox.

sendintent -a "https://google.com#Intent;action=android.intent.action.VIEW;end"