Good evening guys i m new on android development and i am making a car mode app. simply 4 buttons to open 4 most common apps you use. I have calls contacts music and gps. But in every phone the package has different package name in exmple in google is com.google.music but in htc is different so the app crashes. i need the code when i click the button to give me all the apps and then choose the app i want to open.
PGiorgos said:
Good evening guys i m new on android development and i am making a car mode app. simply 4 buttons to open 4 most common apps you use. I have calls contacts music and gps. But in every phone the package has different package name in exmple in google is com.google.music but in htc is different so the app crashes. i need the code when i click the button to give me all the apps and then choose the app i want to open.
Click to expand...
Click to collapse
you can use intents, gallery intent, camera intent, music intent, they are global and work on any device
mohamedrashad said:
you can use intents, gallery intent, camera intent, music intent, they are global and work on any device
Click to expand...
Click to collapse
thank you!
Well i ve found the intent for music
Intent intent = new Intent(MediaStore.INTENT_ACTION_MUSIC_PLAYER);
startActivity(intent);
But i have problem finding the same for contacts any suggestion?
PGiorgos said:
Well i ve found the intent for music
Intent intent = new Intent(MediaStore.INTENT_ACTION_MUSIC_PLAYER);
startActivity(intent);
But i have problem finding the same for contacts any suggestion?
Click to expand...
Click to collapse
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT);
here we go
press thanks if i helped you
Related
Hi everyone,
Could someone tell me if it possible to close system AlertDialog raised by PhoneApp (ussd reply) from my app? I tried to send keystrokes "Down" and "Enter" but for android i can send keystrokes for my app only. Method that worked is to reload package "com.android.phone", but i don't like it, maybe there is a better solution (hack, undocumented...)?
Thanks in advance
No, to the best of my knowledge. Android runs each app in its own VM; one app can not access what another app is doing (kind of, think "content providers for the exception).
Hi,
I have made a widget that update every 6 hour, however i wont to make i posible to update the widgate instant by one press on the widget.
Is there a kind person there can help me with the code for this?
i ned to know how i can make a picture in the widget app to run the update class.
Wackey said:
Hi,
I have made a widget that update every 6 hour, however i wont to make i posible to update the widgate instant by one press on the widget.
Is there a kind person there can help me with the code for this?
i ned to know how i can make a picture in the widget app to run the update class.
Click to expand...
Click to collapse
Did you look at already at this
?
Dark3n said:
Did you look at already at this
?
Click to expand...
Click to collapse
Thanks for your replay,
I have unfortunately not had the fortune to implement the code in my program. the only thing that must happen is that it should update some text. and to do this, it have to eksikvere " private static void refreshTextInWidget(Context context, RemoteViews updateViews) "
Hey guys,
i'm looking for someone who can build me a little app that simply redirects me to the "mobile network settings" page.
Probably, that's very simple and I can do this for myself but i haven't installed the SDK and also I haven't programmed for Android before.
I needn't to be a widget, a shourcut on homescreen without an icon would be absolutly OK.
There are some widgets in market but they caused some strange bugs on my LG P500
If there is someone who can spend some time for me, it would be great
Sorry for my english, i'm german...
Hey,
for some reason, I couldn't get the intent to work properly so I just made it so they app runs an am command in the shell. It should work though. Let me know if there are any problems.
Also, your english is fine. There are so many people here who are about 1000 times worse..
Works fine on first startup, but on relaunch there is only a blank activity with the programm title on top and I have to close the app manually with a task manager
Is there any possibility to fix this?
singmea1337 said:
Works fine on first startup, but on relaunch there is only a blank activity with the programm title on top and I have to close the app manually with a task manager
Is there any possibility to fix this?
Click to expand...
Click to collapse
Harr then let me take a shot at it .
.apk file is in attachment, let me know if it does what you wanted.
If it does it, i will be happy with a thanks!
und dein Englisch ist ok...
oh right, of course. That makes sense. I really didn't go about this the right way. Maybe someone else can come up with a better solution. Anyway, I updated it so the issue you were describing won't happen. However, now you can't back out of the application. As soon as you back out of the mobile network settings, my app comes back into focus and starts the mobile network settings again. I'm sure there's an easy fix. Maybe I'll look at it again after work.
okay, I wasn't thinking straight before. There was an extremely easy solution. Dark3n has probably already done it but whatever.
smaskell said:
oh right, of course. That makes sense. I really didn't go about this the right way. Maybe someone else can come up with a better solution. Anyway, I updated it so the issue you were describing won't happen. However, now you can't back out of the application. As soon as you back out of the mobile network settings, my app comes back into focus and starts the mobile network settings again. I'm sure there's an easy fix. Maybe I'll look at it again after work.
Click to expand...
Click to collapse
it is quite easy, let me help you out
if you have questions, feel free to ask
Code:
package eu.thedarken.nsq;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
public class NSQmain extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName cn = new ComponentName("com.android.phone","com.android.phone.Settings");
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
}
@smaskell
Now, there is only an black screen after the first launch.
But the solution by Dark3n works like a charm
Thanks!
edit:
Oh, too slow, i'm talking of post 5
As I told you already, the widgets I tested caused some bugs. The app from Dark3n got the same issue.
If I change network mode to 2G only, the telephone app crashes without any comments after clicking the call-button. That couldn't be normal?
I've tested this one (couldn't post direct links, search com.curvefish.widgets.network2g3gonoff on market) before and if I clicked on the widget (after such a crash) the call was started
The same thing happens if i launch the app from Dar3n directly from menu but not if i use the shortcut.
If I change the mode directly via menu or using this (de.softxperience.android.switchnetworktype) app there are no problems.
But the last linked app adds a shortcut on the status-bar drop-down and in my opinion that's stupid.
I've checked the app from smaskell but there's still a problem on relaunch...
edit: And there's the same problem..
Sorry for the double-posting..
I will take a look at that later in the evening.
Maybe the settings only gets saved properly after closing parent menus.
By directly calling the submenu this doesn't happen and thats why it FCs.
I dont know if this will help you, but you can start the setting via terminalemulator
Code:
am start -n com.android.phone/.Settings
Sent from my HTC Vision using XDA App
kingchris said:
I dont know if this will help you, but you can start the setting via terminalemulator
Code:
am start -n com.android.phone/.Settings
Sent from my HTC Vision using XDA App
Click to expand...
Click to collapse
Thats basicly how i start it too.
Building App: Buttons & Slider to send serial commands to wifi or BT connection
Ops, sorry, thought I was posting in a new thread. Didn't want to take over yours.
Cant you just use anycut and point it to the right activity?
Sent from my GT-I9100 using XDA App
Dev discussion:
I think what the button does is launch an intent which opens the Bixby app. Maybe if I record the intent identifier and use it in a 3rd party app (maybe also with the Bixby package name) my 3rd party app intent will be called on button press. Then I could redirect the call to whatever the user wants to happen.
I will try this as soon as possible, tell me what you think
So I recorded the actual intent:
Code:
ActivityManager: Unable to start service Intent {
cmp=[B]com.samsung.android.bixby.agent/com.samsung.android.bixby.WinkService[/B] launchParam=MultiScreenLaunchParams {
mDisplayId=0 mBaseDisplayId=0 mFlags=0
} (has extras)
} U=0: not found
Now the problem is that I can't seem to install a package with the same name even though the original Bixby package is disabled.. I also can not upgrade because Samsung throws me an error.
I'm not sure if I can catch the intent without having the matching package name but I will try that next
Not a dev but thank you
Sent from my iPhone using Tapatalk
I have a feeling this won't end up being possible without root access. Since they're intercepting it before it gets to the accessibility service, I bet you won't be able to intercept the intent from a user level app either. I'd love to be wrong, but even then Samsung could probably patch it again.
datajosh said:
I have a feeling this won't end up being possible without root access. Since they're intercepting it before it gets to the accessibility service, I bet you won't be able to intercept the intent from a user level app either. I'd love to be wrong, but even then Samsung could probably patch it again.
Click to expand...
Click to collapse
I guess you are right. What I've found out is that I can detect a button press with "logcat | fgrep -i WinkService" (try this via adb). This is more of a dirty solution but nevertheless it works.
Of course they will patch it but there's always a possibility.
Is there any way to envoke bixby without the hard button? It is not listed as an app of any sort. By the way, so far "bx actions" still works on my Verizon S8 but I haven't yet had any updates available.
Termynat0r said:
I guess you are right. What I've found out is that I can detect a button press with "logcat | fgrep -i WinkService" (try this via adb). This is more of a dirty solution but nevertheless it works.
Of course they will patch it but there's always a possibility.
Click to expand...
Click to collapse
Oh god, that would require polling the logcat output wouldn't it?
MishaalRahman said:
Oh god, that would require polling the logcat output wouldn't it?
Click to expand...
Click to collapse
Yes but at least it's already filtered so you can invoke at every second output (because intent gets called on button down AND up)
xgman said:
Is there any way to envoke bixby without the hard button? It is not listed as an app of any sort. By the way, so far "bx actions" still works on my Verizon S8 but I haven't yet had any updates available.
Click to expand...
Click to collapse
It can be called from any app. So an app that remaps the button could also place a Bixby shortcut in the launcher
Would've given anything to replace that Bixby shortcut to just launch the camera app. Sad to see they changed the workaround.
Tried a bixby shortcut in Nova but it crashed on launch when the button was mapped to something else. Not sure if it would have worked if the button was not remapped.
Slightly off topic but what app needs to be disabled to prevent SW update so my bx hack continues to work?
suzook said:
Slightly off topic but what app needs to be disabled to prevent SW update so my bx hack continues to work?
Click to expand...
Click to collapse
use the samsung disabler pro app in PS and check look for software update, there should be two of them that you check
xgman said:
Is there any way to envoke bixby without the hard button? It is not listed as an app of any sort. By the way, so far "bx actions" still works on my Verizon S8 but I haven't yet had any updates available.
Click to expand...
Click to collapse
You can use Quick Shortcut Maker.
Code:
Application: Hello Bixby
Activity: Hello Bixby
Package/Class: com.samsung.android.app.spage/com.samsung.android.app.spage.main.MainActivity
Goole Play: https://play.google.com/store/apps/details?id=com.samsung.android.app.spage
--
This information is exported by QuickShortcutMaker v2.4.0.
https://play.google.com/store/apps/details?id=com.sika524.android.quickshortcut
Sent from my SM-G955U using XDA-Developers Legacy app
suzook said:
Slightly off topic but what app needs to be disabled to prevent SW update so my bx hack continues to work?
Click to expand...
Click to collapse
In addition to using Package Disabler Pro,check your Developer Options for an Automatic Update toggle..................
I want to terminate an external activity from my app. how do i do it... Im new to android development
私は苦しんでいます said:
I want to terminate an external activity from my app. how do i do it... Im new to android development
Click to expand...
Click to collapse
Old question, but i'll bite. To close another application, I think you can send the correct intent requesting it to close itself. But to actually close another app no questions asked, I think your going to need root. And then you also have the option to force-close it ie "hibernate" the app. Use a rooted shell command.