aspose file tools*
The moose likes Android and the fly likes Trying to collect wifi data like Metal Gear Solid Portable Ops Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "Trying to collect wifi data like Metal Gear Solid Portable Ops" Watch "Trying to collect wifi data like Metal Gear Solid Portable Ops" New topic
Author

Trying to collect wifi data like Metal Gear Solid Portable Ops

John Quach
Ranch Hand

Joined: Sep 28, 2011
Posts: 50
Hello, I'm trying to create an app that scans for wifi. When the player does something in the game, it "consumes" the strongest wifi signal. That signal should no longer be detected on the next scan.

Anyone whos played Metal Gear Solid Portable ops would know what I mean.

I've spent a good 8 hours today trying to do this and now I'm lost.

The plan was to have the Briefing class load first. The Briefing Class looks for wireless signals after the player clicks the button "Search Town". It then returns the strongest wifi signal and it is ignored forever after scanning for Wifi again. The next the player clicks "Search Town", if the strongest signal happens to be the one scanned before, it is ignored and the second strongest signal is considered. Then that is ignored, and so on and so on. I tried to do this by creating a List of Wireless Signals that have already been scanned.

But its one problem after another. The Briefing class loads successfully, but when I click "Search Town", the app crashes.

Please help.



Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42592
    
  65
What does this code do now, what do you still want it to do, and where are you stuck implementing the missing parts?


Ping & DNS - my free Android networking tools app
John Quach
Ranch Hand

Joined: Sep 28, 2011
Posts: 50
Ulf Dittmer wrote:What does this code do now, what do you still want it to do, and where are you stuck implementing the missing parts?


Ok I've updated my opening post.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42592
    
  65
If an Android app crashes, then the first step is to examine the logcat output. It contains the full stack trace of the exception that caused the crash -including the line number of the of the piece of code where the crash happened- and generally points you in the direction of the problem.
John Quach
Ranch Hand

Joined: Sep 28, 2011
Posts: 50
Ok, it's working again. It's loading all the Wifi networks into a List, then it looks for the best Signal Strength. When the player presses "Search Town", it'll say in a Toast, "Found food and ammo at StarBucksWifi town". StarBucksWifi town is a wireless network with the best signal strength.

Now I want to make it so that when the player "gathers ammo and food" at Starbucks, the game will then ignore StarBucksWifi and find the strongest Signal Strength that isn't on an Ignore List. I've tried to figure this out myself, but I am at a lost.

Here's the code that worked.




John Quach
Ranch Hand

Joined: Sep 28, 2011
Posts: 50
This is what I want. Let's say there are three networks in range. Network A, B, and C. The app finds these networks and prints out only the strongest network...which is Network A. Once printed out, A is now ignored. The next time the app scans for networks, if it comes across network A again, it is ignored and declares Network B to be the strongest. My problem is that Network A continues to be printed out over and over and over again.

Every attempt to try and ignore previously used networks have failed. I tried using another list and adding used networks to it so that it won't be used again.

Either it crashes, or it continues to use the best network without the app ignoring it.

J. Insi
Ranch Hand

Joined: Aug 11, 2010
Posts: 90
i think it's very easy. Here is the algorithm for you:

1) Make an object OOP like this:
Wireless:
-Name
-FoundStat
2) Detect all networks
2) Put the strongest network inside the Object OOP above. Set the name,
set the foundstat to true. Put 'em into arraylist.
3) Detect all networks again.
4) Now let's check if the network found is similar to the network inside the arraylist?
5) If yes, dont print them out
6) If no, print them out and do the step 2 again repeatedly.

Done
Hope you could figure out the code by yourself. I just simplify the
algorithm for you. CMIIW.
 
 
subject: Trying to collect wifi data like Metal Gear Solid Portable Ops