Create shortcut on homescreen using ADB

2019-07-20 04:13发布

I'm running JavaME MIDlets on my Android phone using PhoneME, and it's great. To run MIDlets, I have to start the Foundation Profile App, and then choose MIDlet to start.

I wish to create shortcuts to the MIDlets from my homescreen using ADB, and have been searching a lot. StackOverflow has a few posts about it, but none that gives a clear answer. I can't believe it's not possible.

To start a MIDlet on the phone from my PC using ADB, I can type this:

./adb shell am start -d file:///sdcard/MyMidlet.jad be.preuveneers.phoneme.fpmidp/.MidletActivity

Is there no ADB command that'll create a shortcut on my homescreen to that command line?

Thanks

EDIT:

I have managed to create a shortcut now using this code:

Intent shortcut = new Intent(Intent.ACTION_VIEW);
shortcut.setClassName("be.preuveneers.phoneme.fpmidp", "be.preuveneers.phoneme.fpmidp.MidletActivity");
shortcut.setData(Uri.parse("file:///sdcard/MyMidlet.jad"));

Intent intent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "My shortcut");
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcut);

sendBroadcast(intent);

Now the question is, can the above code be written as an ADB command line? If so, how does that command-line look like?

Thanks

标签: android adb
0条回答
登录 后发表回答