iitc-project / ingress-intel-total-conversion

ingress.com/intel total conversion user script with some new features. Should allow easier extension of the intel map.
http://iitc.jonatkins.com/
ISC License
991 stars 552 forks source link

Additional plugins for the mobile app #422

Open m4665832 opened 11 years ago

m4665832 commented 11 years ago

Is this feature still active? I read about it here: https://github.com/jonatkins/ingress-intel-total-conversion/issues/327 I stored my script at /storage/{internal|external}_sdcard/IITC_Mobile/plugins/. At first I thought maybe highlight plugins are not supported because the plugin didn´t showed up. Then I copied two plugins files (extracted out of the apk) to the same direction just to be sure if my own plugin has failures. Those plugins also didn´t showed up. I´m thankful for every hint!

jonatkins commented 11 years ago

The plugins need to be turned on in the settings - they'll probably be listed in their own category [User] Misc

If they're not listed there, the path is wrong.

To find out the correct path, temporarily tick the 'developer mode' option. This should pop up an error message briefly showing the path used (but with 'dev' instead of 'plugins')

leCradle commented 11 years ago

I am thinking about making this path configurable too, because a friend of mine had the same issue. On some devices Environment.getExternalStorageDirectory().getPath() (the external storage path we are using) seems to be not very well defined... :) Making this path an option would be a hint for this feature too, I think most of the people just don't know that IITC is able to load additional plugins. What do you think @jonatkins ? Will push this, if I get your thumbs up.

m4665832 commented 11 years ago

Found the path. For me it is: "/storage/emulated/0/IITC_Mobile/dev/" but it doesn´t work. Even if I copy the files from $IITC_folder/build/mobile to it I get an error: /storage/emulated/0/IITC_Mobile/dev/total-conversion-build.user.js not found. But it is there. ;-)

leCradle commented 11 years ago

Odd....are you sure? How did you check that the file is there? How did you copied them to the given path? If the file (path+name correct) is really there and iitcm says that it's not, this would mean that sometimes the android file scanner throws a FileNotFound exception even if the file is there... Oo

Btw...my external storage path is the same as yours and it works for me...

m4665832 commented 11 years ago

I copied the files via USB from my pc. Here are some screenshots: screenshot_2013-07-17-08-45-51 screenshot_2013-07-17-10-49-04

leCradle commented 11 years ago

Odd....one more thing...what are the properties of the file? Maybe the permissions are not set correctly... It should look like this:

screenshot_2013-07-17-11-04-21

m4665832 commented 11 years ago

Here are the permissions: screenshot_2013-07-17-11-11-01 My file seems to be bigger but I guess you have just an older version...

leCradle commented 11 years ago

Ok...looks good. Strange... Are you able to provide a logcat output? If yes, then please try out this build: http://iitcm.code-noobs.org/IITC-Mobile-2013-07-17-131603.apk Test the dev-mode again and filter the logcat output with "iitcm". The interesting part should look like this:

D/iitcm (16647): adding iitc main script D/iitcm (16647): failed to parse file /storage/emulated/0/IITC_Mobile/dev/total-conversion-build.user.js D/iitcm (16647): files in iitc folder:/storage/emulated/0/IITC_Mobile/dev D/iitcm (16647): files in iitc folder:/storage/emulated/0/IITC_Mobile/plugins D/iitcm (16647): files in iitc folder:/storage/emulated/0/IITC_Mobile/key ids D/iitcm (16647): files in iitc folder:/storage/emulated/0/IITC_Mobile/com.cradle.iitc_mobile-2.apk D/iitcm (16647): files in iitc folder:/storage/emulated/0/IITC_Mobile/total-conversion-build.user.js D/iitcm (16647): files in dev folder:/storage/emulated/0/IITC_Mobile/dev/plugins D/iitcm (16647): files in dev folder:/storage/emulated/0/IITC_Mobile/dev/user-location.user.js

(I removed the script to "reproduce" the problem). I wonder if iitcm is able to open and list the 2 folders on your device...

m4665832 commented 11 years ago

Here is my log: 07-17 13:47:58.669: D/iitcm(3005): adding iitc main script 07-17 13:47:58.679: D/iitcm(3005): failed to parse file /storage/emulated/0/IITC_Mobile/dev/total-conversion-build.user.js 07-17 13:47:58.689: D/iitcm(3005): loading url: https://www.ingress.com/intel?vp=m 07-17 13:47:58.689: D/iitcm(3005): resuming...setting reset idleTimer 07-17 13:47:58.689: D/iitcm(3005): connected to wifi...load tiles from network 07-17 13:48:00.250: D/iitcm(3005): replacing gen_dashboard.js with iitc script 07-17 13:48:00.250: D/iitcm(3005): injecting iitc...

leCradle commented 11 years ago

@m4665832 thx for your help regarding this issue. Did you used the apk I linked above for the logcat output? If yes, then it is definitely no iitcm related issue. Since you get no "files in [...] folder" output, there are no files in /storage/emulated/0/IITC_Mobile/ and /storage/emulated/0/IITC_Mobile/dev/ ... which could mean that:

1) the directories do not exist 2) there are no files inside (think we can exclude this) 3) the app has no permissions to enter these directories (I think we can exclude this too, since you can access it with your file explorer)

So...you could check that the permissions of both folders (IITC_Mobile and dev) are "rwxrwxr-x"... Another option zip and upload your IITC_Mobile folder, then I will check it on my device...

m4665832 commented 11 years ago

I used the apk linked above. As you can see in the pictures above the directorie should exist. I checked it very often. ;-) Maybe too often. The folders should be spelled correctly, right? Both folders have the premissions "rwxrwxr-x". Here is my IITC_Mobile folder: https://docs.google.com/file/d/0Bxh4nzci6ICVbnI1eVpNdUVMdkk/edit?usp=sharing

leCradle commented 11 years ago

Ok your folder works on my device... So maybe something is broken with your external storage: quotation from: http://developer.android.com/guide/topics/data/data-storage.html#filesExternal

"It's possible that a device using a partition of the internal storage for the external storage may also offer an SD card slot. In this case, the SD card is not part of the external storage and your app cannot access it (the extra storage is intended only for user-provided media that the system scans).

Caution: External storage can become unavailable if the user mounts the external storage on a computer or removes the media, and there's no security enforced upon files you save to the external storage. All applications can read and write files placed on the external storage and the user can remove them."

Please check if something of this happens...maybe you didn't unmounted the media correctly after the usb-transfer...? If you install this version of iitcm http://iitcm.code-noobs.org/IITC-Mobile-2013-07-17-153154.apk you will get a logcat output if your media is mounted correctly or not.

should be something like: D/iitcm (25491): failed to parse file /storage/emulated/0/IITC_Mobile/dev/total-conversion-build.user.js D/iitcm (25491): media mounted correctly

jonatkins commented 11 years ago

I did have a friend of mine report the 'dev mode' issue to me too - I forgot to look into the details though.

@m4665832 at least you know where user plugins should go now. Change 'dev' to 'plugins' in the path, copy your custom pougins there, and turn developer mode off.

Also, are you building on Windows or Linux? I know there were plugin-related parse errors with line endings (CRLF vs LF), so perhaps some issues here are left for 'developer mode'?

leCradle commented 11 years ago

@jonatkins nope I don't think that it is a CRLF vs LF related issue, because I tested his complete IITC_Mobile folder on my device and it worked without any problems. Dev-Mode as well as the additional plugins...

m4665832 commented 11 years ago

My device (Galaxy S4) has an SD card slot but the path to this card is /storage/extSdCard and should not affect this problem. Maybe the external SD card is mounted somewhere additionally but I´m not sure about that. Additionally I tested it after a complete reboot and it was not connected to any other device. But this should not be the problem as you can see in this logcat while connected to my pc:

07-18 08:09:05.685: D/iitcm(10615): adding iitc main script 07-18 08:09:05.695: D/iitcm(10615): failed to parse file /storage/emulated/0/IITC_Mobile/dev/total-conversion-build.user.js 07-18 08:09:05.695: D/iitcm(10615): media mounted correctly 07-18 08:09:05.715: D/iitcm(10615): loading url: https://www.ingress.com/intel?vp=m

@jonatkins It doesn’t work. I guess the reason why it doesn’t work in developer mode is the same why it doesn’t work with my plugins.

leCradle commented 11 years ago

@m4665832 I tested your setup on a Galaxy S4 of a friend of mine and it works without any problems...I am a little bit clueless what's going on on your device... :(

m4665832 commented 11 years ago

@leCradle Ok, looks like I´m doing something wrong. Does he have the original firmware? I have the orginal firmware (not the newest, buildnumber: JDQ39) and it´s rooted but that should not be the reason.

What do use see, when you use my IITC_Mobile folder and developer mode is on? Can you post a screenshot? Do you see the plugins I added in the plugins folder, when developer mode is off?

leCradle commented 11 years ago

@m4665832 He is on Cyanogenmod 10.1. Unfortunately, I don't know anyone with a S4 on stock firmware. But I don't think (hope so) that the firmware causes the issue. Furthermore, I wonder why other apps (your explorer for example) can read your files...

Your IITC_Mobile folder worked as expected. The dev-mode says that it's enabled and loads all activated plugins + iitc. And yes, your additional plugins were listed and worked too...

m4665832 commented 11 years ago

I will play a little bit more with it. And I will post my progress here. I still think this is a permissions problem. The phone storages (internal and external sd card) are not directly mounted to my pc. It is presented as a single media device. I will try to create the folders directly on my phone and once with adb.