[Q] [APP]org.JSON .NET Web Service - General Questions and Answers

I'm hosting a .net Web Service and want to retrieve this using org.JSON.JSONArray. I did a little tutorial and was able to get twitter/timeline.json... no problem...
My Experience with web services has always been soap action, soap methods and all that garbage... my URL is a webservice.asmx...
My question is how do i call my .asmx web service using JSON
the tutorial: very simple
Code:
try
{
URL url = new URL("http://twitter.com/statuses/public_timeline.json");
URLConnection tc = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(tc.getInputStream()));
String line;
while ((line = in.readLine()) != null)
{
JSONArray ja = new JSONArray(line);
for (int i = 0; i < ja.length(); i++)
{
JSONObject jo = (JSONObject)ja.get(i);
myArray.add(jo.getString("text"));
}
}
}
catch(Exception e)
{
}

I've looked at other methods such as HttpClient, WCF... I'm using Ksoap2, that works good enough, but i was looking for something a bit more RESTful... any thoughts? I just need a little help.

Related

[Q][VB.NET] Access remote XML services

EDIT: Development continued Working hard
Hello everyone
I'm trying to port my WIP Infosode from Android (Adobe AIR) to Windows Phone 7, and I have some big problems figuring out how to access a remote XML service, in this case http://services.tvrage.com/
I've used Visual Basic .NET for both desktop and Windows Mobile applications and now for WP7, so I got some VB.NET experience.
Any help is appreciated and will be noted in the finished application.
Regards
//
IzaacJ
Here is one somewhat dirty way.
Download your data (xml) into the isolated storage. After that process the xml file stored.
Code:
WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
client.DownloadStringAsync(new Uri("http://path.to/the/" + item + ".xml/"));
static void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
// If we have results
if (!string.IsNullOrEmpty(e.Result))
{
#region Save to Isolated Storage
try
{
// Isolated Storage Directory
string xmlStorageDirectory = "Profiles";
using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
{
// File Path
string filePath = Path.Combine(xmlStorageDirectory, String.Format("{0}.xml", ActiveID));
// Check if the Directory exists. If not create it
if (!store.DirectoryExists(xmlStorageDirectory))
{
store.CreateDirectory(xmlStorageDirectory);
}
// Use Isolated Storeage to write the file
using (IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(filePath, FileMode.Create, store))
{
// Use the stream to write the file
using (StreamWriter stream = new StreamWriter(fileStream))
{
stream.Write(e.Result.Replace(" & ", " & "));
}
}
}
}
// OMG EXCEPTIONS :(
catch (IsolatedStorageException exception)
{
throw exception;
}
#endregion
#region Reading
using (var appStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (var file = appStorage.OpenFile("Profiles/" + ActiveID + ".xml", FileMode.Open))
{
XmlReader reader = XmlReader.Create(file);
CharacterDataModel profile = new CharacterDataModel();
List<PlayerTraitsModel> traits = new List<PlayerTraitsModel>();
PlayerTraitsModel trait = new PlayerTraitsModel();
bool isCdata = false;
bool isPdata = false;
// While we read the data
while (reader.Read())
{
#region Character
if (reader.Name == "cdata") isCdata = true;
if (isCdata)
{
if (reader.NodeType == XmlNodeType.Element)
{
#region Check for the following values and shallow copy that to the model
//string item = reader.ReadElementContentAsString();
switch (reader.Name)
{
case "id":
profile.id = reader.ReadElementContentAsString();
break;
}
#endregion
}
}
if (reader.NodeType == XmlNodeType.EndElement && reader.Name.Contains("cdata"))
isCdata = false;
#endregion
}
}
}
#endregion
}
}
Thanks for that
Will try to adopt it to VB.NET and see if it will work
At least it's something that I could use until I find a better way.
Regards
Hi,
Use the OpenReadCompleted event of the WebClient, and then put the result into an XDocument by using an XmlReader; from there it's easy to process it (using LINQ to XML) without having to store the XML anywhere first (i.e. do it all in memory). Here's kind of how I do it C#.
Code:
WebClient client = new WebClient();
// Set up the 'completed' event before loading anything
client.OpenReadCompleted += (sender, e) =>
{
if (e.Error != null)
{
if (e.Error is WebException)
{
... Either a connection error, or an invalid status code has been returned. You can determine which using code.
}
else
... // some other exception
return;
}
// Turn the result into an XDocument and parse using LINQ
try
{
Stream aStream = e.Result;
XmlReader anXmlStream = XmlReader.Create(aStream);
XDocument ourXDocument = XDocument.Load(anXmlStream);
// Parse the XML here - best to use 'Linq to XML' to do it
List<TvShow> TVShows = from aShow in ourXDocument.Descendants("show")
select new TvShow() {
ShowName = aShow.Element("name").Value,
Link = aShow.Element("link").Value
};
//////////////////
str.Close();
// if here it all went to plan
}
catch (XmlException xe)
{
...
}
catch (Exception ge)
{
...
}
};
// Here's the bit that actually sets it going
try
{
client.OpenReadAsync(new Uri(URL, UriKind.Absolute));
}
catch (OutOfMemoryException)
{
... Handle the exception
}
catch (StackOverflowException)
{
... Handle the exception
}
catch (Exception ge)
{
... Handle the exception
}
If you're doing this kind of thing a lot it's good to set it up as reusable class that either has it's own events (e.g. ItemsLoaded, ErrorOccured, and ProcessItems) that can be subscribed to, or if you prefer you can have them as methods to override so that you can use it as a web service loading base class from which you can inherit.
Hope that helps. Good luck with it
Ian
otherworld said:
Hi,
Use the OpenReadCompleted event of the WebClient, and then put the result into an XDocument by using an XmlReader; from there it's easy to process it (using LINQ to XML) without having to store the XML anywhere first (i.e. do it all in memory). Here's kind of how I do it C#.
Code:
WebClient client = new WebClient();
// Set up the 'completed' event before loading anything
client.OpenReadCompleted += (sender, e) =>
{
if (e.Error != null)
{
if (e.Error is WebException)
{
... Either a connection error, or an invalid status code has been returned. You can determine which using code.
}
else
... // some other exception
return;
}
// Turn the result into an XDocument and parse using LINQ
try
{
Stream aStream = e.Result;
XmlReader anXmlStream = XmlReader.Create(aStream);
XDocument ourXDocument = XDocument.Load(anXmlStream);
// Parse the XML here - best to use 'Linq to XML' to do it
List<TvShow> TVShows = from aShow in ourXDocument.Descendants("show")
select new TvShow() {
ShowName = aShow.Element("name").Value,
Link = aShow.Element("link").Value
};
//////////////////
str.Close();
// if here it all went to plan
}
catch (XmlException xe)
{
...
}
catch (Exception ge)
{
...
}
};
// Here's the bit that actually sets it going
try
{
client.OpenReadAsync(new Uri(URL, UriKind.Absolute));
}
catch (OutOfMemoryException)
{
... Handle the exception
}
catch (StackOverflowException)
{
... Handle the exception
}
catch (Exception ge)
{
... Handle the exception
}
If you're doing this kind of thing a lot it's good to set it up as reusable class that either has it's own events (e.g. ItemsLoaded, ErrorOccured, and ProcessItems) that can be subscribed to, or if you prefer you can have them as methods to override so that you can use it as a web service loading base class from which you can inherit.
Hope that helps. Good luck with it
Ian
Click to expand...
Click to collapse
Thanks
I'm building a class with functions for fetching and storing the returned XML requests.
It's smart to store it in the IsoStorage so that the data is available offline as well and it will only download the new XML's if it's updated on the server
I think it will make the application a bit more useful.
Regards
EDIT: I've tried to port the first example from MJCS to VB.Net without success. The app closes itself when it's supposed to search and get results from the server. The URL to the generated XML (including parameters) is http://services.tvrage.com/feeds/search.php?key=[MY_API_KEY]&show=[SHOW_NAME]
The code as for now is this:
Code:
Public Function Search(ByVal SearchString As String) As String
Dim Url As New Uri(XMLUrl & "feeds/search.php?key=" & APIKey & "&show=" & SearchString)
'XMLUrl = http://services.tvrage.com/
'APIKey = My API key from TVRage.com
'SearchString = The showname to be searched for in the database
XML.DownloadStringAsync(Url)
Return 0
End Function
Any ideas?
Regards

[Q][DEV]Android Development Maps Question

I'm trying to develop (for the liveview) using an SDK and need to get a bitmap of Google Maps.
Code:
//Map Section
public class myMap extends MapActivity {
MapView mapView;
Bitmap bitmap;
boolean created = false;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
createMap();
}
public void createMap()
{
// build map and mark point
mapView = new MapView(this, "keykeykeykeykeykey");
mapView.setBuiltInZoomControls(false);
GeoPoint point = new GeoPoint(52242730,-884211);
mapView.getController().animateTo(point);
mapView.preLoad();
// copy MapView to canvas
bitmap = Bitmap.createBitmap(400, 800, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
mapView.draw(canvas);
PluginUtils.sendTextBitmap(mLiveViewAdapter, mPluginId, "Loading Map...", 128, 12);
created = true;
}
public void displayMap()
{
if (created == false)
{
createMap();
}
//Display map on device
Bitmap mybit = Bitmap.createBitmap(128, 128, Bitmap.Config.ARGB_8888);
for(int i = 0; i < 128; i++)
{
for(int j = 0; j < 128; j++)
{
mybit.setPixel(i, j, bitmap.getPixel(i, j));
}
}
//white pixel for debugging
mybit.setPixel(64, 64, Color.WHITE);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
Is what I've got so far, the code in createMap() was in onCreate() but It didn't seem to be called.
Now it just force closes.
Anyone know how to help? Is there a better place to ask development questions?
Thanks.
-=Edit=-
Oh, and here's the routine calling the map thing, every couple of seconds.
Code:
private class Timer implements Runnable {
@Override
public void run() {
// TODO Auto-generated method stub
myMap theMap = new myMap();
theMap.displayMap();
}
}
Okay, looks like you cant use google street map like this.
Anyone looking for similar solution, I used open street map and downloaded 'slipery tiles' png's. They provide java routines for finding the tile url from lat/lon.
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames

[Q] Control cursor PC by WP7

I want to control the PC cursor by WP7, so I try to use the ManipulationDelta in WP7 that can help me to calculate the difference between he star tap and the end tap
Code:
public MainPage()
{
InitializeComponent();
this.ManipulationDelta += new EventHandler<ManipulationDeltaEventArgs>(MainPage_ManipulationDelta);
transformG = new TransformGroup();
translation = new TranslateTransform();
transformG.Children.Add(translation);
RenderTransform = transformG; // you see I don't use any transform here because I don't know where I put. If I use the image.RenderTransform of it will move also for the screen of WP if I put this.RenderTransform, So anyone have a solution
SenderSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
}
void MainPage_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
startX = e.ManipulationOrigin.X;
startY = e.ManipulationOrigin.Y;
DeltaX = e.DeltaManipulation.Translation.X;
DeltaY = e.DeltaManipulation.Translation.Y;
translation.X += e.DeltaManipulation.Translation.X;
translation.Y += e.DeltaManipulation.Translation.Y;
EndX = Convert.ToDouble(translation.X);
EndY = Convert.ToDouble(translation.Y);
}
I am juste want to send DeltaX and DeltaY to the server to calculate them to the mouse position in the screen, So I write this code
Code:
void StartSending()
{
while (!stop)
try
{
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
byte[] buffer = Encoding.UTF8.GetBytes(DeltaX.ToString() + "/" + DeltaY.ToString());
socketEventArg.SetBuffer(buffer, 0, buffer.Length);
SenderSocket.SendToAsync(socketEventArg);
}
catch (Exception) { }
}
I concatenate them in 1 buffer with separate by "/" and in server I use this code to separate
Code:
void Receive(byte[] buffer)
{
string chaine = "";
if (SenderSocket != null)
{
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e)
{
if (e.SocketError == SocketError.Success)
{
chaine = Encoding.UTF8.GetString(e.Buffer, e.Offset, e.BytesTransferred);
chaine.Trim('\0');
string[] pos = chaine.Split('/');
for (int i = 0; i < pos.Length; i++)
{
pX = Convert.ToInt32(pos[0]);
pY = Convert.ToInt32(pos[1]);
this.Cursor = new Cursor(Cursor.Current.Handle);
Cursor.Position = new Point(Cursor.Position.X + pX, Cursor.Position.Y + pY);
}
}
else
{
}
});
SenderSocket.ReceiveFromAsync(socketEventArg);
}
Just I want to control the cursor, if you have any other methods so plz help me and I am really grateful
Didn't you already have a thread about this? Please re-use existing threads instead of starting new ones. Even if it wasn't you, *somebody* was working on this problem already, and very recently. Always use the Search button before starting a thread.
So... what are you looking for from us? Does your current code work? If not, in what way does it fail? Without knowing what your question is, we can't provide answers.
If you want some advice, though...
Sending as strings is very inefficient on both ends; it would be better to use arrays (which you could convert directly to byte arrays and back again).
You're sending as TCP, which is OK but probably not optimal. For this kind of data, UDP is quite possibly better. If nothing else, it provides clearly delineated packets indicating each update.

[Q] Alawyas report network not available when using NewtorkInfo program

0 down vote favorite
share [g+] share [fb] share [tw]
I have wrote a program to check if the network is available or not. Here is my simple code:
Code:
public boolean isNetworkAvailable() {
Context context = getApplicationContext();
ConnectivityManager connectivity=ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity == null) {
boitealerte(this.getString(R.string.alert),"getSystemService rend null");
} else {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null) {
for (int i = 0; i < info.length; i++) {
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
}
return false;
}
I run it on my Android phone, it always returns false but the network is available and I can make calls. Any suggestions>.

Editing the stock MTC Manager

Hey guys, I have a xtrons px5 mtcd head unit and I am trying to figure out without flashing to a custom ROM, how to edit what apps launch at wake, or do not turn off with the unit when it goes to sleep.
I believe it is the MTCManager that is doing these actions, and I have found two interesting parts of the decomplied code.
The first file is android/microntek/a.java
HTML:
package android.microntek;
import android.app.ActivityManager;
import android.app.ActivityManager.MemoryInfo;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.app.ActivityManager.RunningServiceInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.microntek.service.R;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
import java.util.ArrayList;
public class a {
static String cp;
private static boolean cq = false;
static Context cr;
private static int cs = -1;
static Toast ct;
private static final String[] cu = new String[]{"android.microntek.", "com.murtas.", "com.microntek.", "com.goodocom.gocsdk", "android.rockchip.update.service", "com.android.systemui", "com.hct.obd.OBDActivity", "com.unisound", "com.dpadnavi.assist", "com.intel.thermal", "cn.manstep.phonemirror", "com.hiworld.", "com.carboy.launch", "com.android.bluetooth", "net.easyconn", "com.android.launcher", "com.google.android", "com.vayosoft.carsystem"};
static Object cv = new Object();
static a cw;
private static final String[] cx = new String[]{"android.microntek.", "com.murtas.", "com.microntek.", "com.goodocom.gocsdk", "android.rockchip.update.service", "com.android.systemui", "com.hct.obdservice.OBDService", "com.unisound", "com.intel.thermal", "com.dpadnavi.assist", "cn.manstep.phonemirror", "com.android.bluetooth", "com.hiworld.", "net.easyconn", "android.cn.ecar.cds.process.CoreService", "com.google.android", "com.vayosoft.carsystem"};
private a(Context context) {
cr = context;
}
private int ex(Context context) {
int i = 0;
Iterable<e> arrayList = new ArrayList();
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
for (RunningAppProcessInfo runningAppProcessInfo : activityManager.getRunningAppProcesses()) {
int i2 = runningAppProcessInfo.pid;
int i3 = runningAppProcessInfo.uid;
String str = runningAppProcessInfo.processName;
int i4 = activityManager.getProcessMemoryInfo(new int[]{i2})[0].dalvikPrivateDirty;
e eVar = new e();
eVar.fy(i2);
eVar.fz(i3);
eVar.ga(i4);
eVar.gb(str);
eVar.dk = runningAppProcessInfo.pkgList;
arrayList.add(eVar);
String[] strArr = runningAppProcessInfo.pkgList;
}
for (e eVar2 : arrayList) {
int i5;
if (eVar2.gc() < 10000) {
i5 = i;
} else {
String gd = eVar2.gd();
if (gd.indexOf(".") == -1) {
i5 = i;
} else if (fe(gd) || ff(context, gd) || fg(context, gd)) {
i5 = i;
} else if (cs != 0 || fd(gd)) {
try {
activityManager.killBackgroundProcesses(gd);
i5 = i + 1;
} catch (Exception e) {
System.out.println(" deny the permission");
i5 = i;
}
} else {
ez(gd);
i5 = i + 1;
}
}
i = i5;
}
return i;
}
private void ey(Context context) {
Iterable<RunningServiceInfo> runningServices = ((ActivityManager) context.getSystemService("activity")).getRunningServices(100);
System.out.println(runningServices.size());
Iterable<b> arrayList = new ArrayList();
for (RunningServiceInfo runningServiceInfo : runningServices) {
int i = runningServiceInfo.pid;
int i2 = runningServiceInfo.uid;
String str = runningServiceInfo.process;
long j = runningServiceInfo.activeSince;
int i3 = runningServiceInfo.clientCount;
ComponentName componentName = runningServiceInfo.service;
String shortClassName = componentName.getShortClassName();
String packageName = componentName.getPackageName();
PackageManager packageManager = context.getPackageManager();
try {
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 0);
b bVar = new b();
bVar.fh(applicationInfo.loadIcon(packageManager));
bVar.fi(applicationInfo.loadLabel(packageManager).toString());
bVar.fj(shortClassName);
bVar.fk(packageName);
Intent intent = new Intent();
intent.setComponent(componentName);
bVar.fl(intent);
bVar.fm(i);
bVar.fn(i2);
bVar.fo(str);
arrayList.add(bVar);
} catch (NameNotFoundException e) {
e.printStackTrace();
}
}
for (b bVar2 : arrayList) {
if (bVar2.fp() >= 10000) {
String fq = bVar2.fq();
if (!(fd(fq) || ff(context, fq) || fg(context, fq))) {
if (cs != 0 || fe(fq)) {
try {
context.stopService(bVar2.fr());
} catch (SecurityException e2) {
System.out.println(" deny the permission");
}
} else {
ez(fq);
}
}
}
}
}
private long fa(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
MemoryInfo memoryInfo = new MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
return memoryInfo.availMem;
}
public static a fc(Context context) {
a aVar;
synchronized (cv) {
if (cw == null) {
cw = new a(context);
}
cs = -1;
aVar = cw;
}
return aVar;
}
private boolean fd(String str) {
for (String startsWith : cx) {
if (str.startsWith(startsWith)) {
return true;
}
}
return cp != null && str.equals(cp);
}
private boolean fe(String str) {
for (String startsWith : cu) {
if (str.startsWith(startsWith)) {
return true;
}
}
return cp != null && str.equals(cp);
}
private boolean ff(Context context, String str) {
if (context == null || TextUtils.isEmpty(str)) {
return false;
}
for (InputMethodInfo packageName : ((InputMethodManager) context.getSystemService("input_method")).getInputMethodList()) {
if (str.equalsIgnoreCase(packageName.getPackageName())) {
return true;
}
}
return false;
}
private boolean fg(Context context, String str) {
try {
for (ResolveInfo resolveInfo : context.getPackageManager().queryIntentServices(new Intent("android.service.wallpaper.WallpaperService"), 128)) {
if (str.equalsIgnoreCase(resolveInfo.serviceInfo.packageName)) {
return true;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
public void ew(int i, String str) {
cs = i;
cq = true;
cp = str;
long fa = fa(cr);
ey(cr);
int ex = ex(cr);
long fa2 = fa(cr);
if (i == 1) {
fa = Math.abs(fa2 - fa);
CharSequence string = cr.getString(R.string.clear_message, new Object[]{Integer.valueOf(ex), Formatter.formatFileSize(cr, fa)});
if (ct == null) {
ct = Toast.makeText(cr, string, 0);
} else {
ct.cancel();
ct = Toast.makeText(cr, string, 1);
}
ct.show();
}
cq = false;
}
public void ez(String str) {
if (str != null && str.length() != 0) {
try {
((ActivityManager) cr.getSystemService("activity")).forceStopPackage(str);
} catch (SecurityException e) {
System.out.println(" deny the permission");
}
}
}
public boolean fb() {
return cq;
}
}
it appears as though it is listing which apps either stay awake on sleep, or launch at boot. Can anybody confirm this?
And in this file, it looks like it might be controlling the apps in the apploop, maybe...
file is android/microntek/c.java
HTML:
package android.microntek;
import android.microntek.service.R;
public class c {
public static final String[] dg = new String[]{"com.microntek.avin", "com.microntek.dvr", "com.microntek.dvd", "com.microntek.tv", "com.microntek.media", "com.microntek.music", "com.microntek.radio", "com.microntek.ipod", "com.microntek.btMusic", "com.microntek.bluetooth", "com.microntek.civxusb", "com.microntek.tv", "com.microntek.dvr"};
public static final String[] dh = new String[]{"com.microntek.avin", "com.microntek.dvr", "com.microntek.dvd", "com.microntek.tv", "com.microntek.media", "com.microntek.music", "com.microntek.radio", "com.microntek.ipod", "com.microntek.btMusic", "com.microntek.dvr"};
public static final String[] di = new String[]{"com.microntek.radio", "com.microntek.dvd", "com.microntek.music", "com.microntek.media", "com.microntek.ipod", "com.microntek.avin"};
public static final int[] dj = new int[]{R.string.music_style0, R.string.music_style1, R.string.music_style2, R.string.music_style3, R.string.music_style4, R.string.music_style5, R.string.music_style6};
}
Let me know what you guys think.
You are absolutely correct. Check out the thread on the Malaysk ROM for the PX5. A member, Nico84, is working with the same files. You guys may want to join forces on this.
Johan
Thanks for that, does that work on the Stock firmware, or only on Malaysk's Custom ROM?
Not sure, but I believe it will work on stock. Needs to be rooted I suppose. Contact Nico84 for details, I am not an experienced Android developer.
I did, thanks for the lead on that, exactly what I was looking for. It looks like it should work on stock firmware so ill probably give it a try
So I took Nico84's MTCManager and tried to decompile and add spotify and accuweather to it, and recompile it. But then the actualy MTCManager did not work, so not sure what I did wrong.
semaj4712 said:
So I took Nico84's MTCManager and tried to decompile and add spotify and accuweather to it, and recompile it. But then the actualy MTCManager did not work, so not sure what I did wrong.
Click to expand...
Click to collapse
You have to compile it with original signature, not testkeys. You can use "tickle my android"
Bummer, tickle my android does not seem to work on mac which is all I have, is there any other way to compile with original signature with apktools? Or would it be possible to make me a version that allows spotify and accuweather to remain open, that would be great.
Ok so I found the documentation on signatures for the APKtool, but it still didnt work. Just to be clear I started this command
Code:
apktool d MTCManager.apk
then I made the changes to the smali.d file, and then recompiled with this command
Code:
apktool b MTCManager/ -c
Is there something I am doing wrong? (The location of files is not exact, bare in mind I am doing this on a mac via terminal so I simply drag and drop the file which returns the path it needs.)
On second try I was able to get this to work. The above commands worked perfectly, my guess is I messed something up the first time around.
For PX3:
when the unit comes back from sleep it sends Intent com.cayboy.action.ACC_ON
when it goes to sleep it sends com.cayboy.action.ACC_OFF

Categories

Resources